package com.wondream.myframework.app.request.billbui;

import com.wondream.myframework.app.request.billbui.encrypt.HyBase64;
import com.wondream.myframework.app.request.gateway.encrypt.HyTreeDesPKCPaddingUtil;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.junit.Test;

public class Encoder {
    public static final byte FIX_KEY_LOGIN[] = "FC5B8717495251443A9A6D90AF59A3A4FC5B871749525144".getBytes();
    public static final byte[] keyiv = new byte[]{8, 7, 6, 5, 4, 3, 2, 1};

    public static String encode(String plainText){
        try {
            return HyBase64.encode((HyTreeDesPKCPaddingUtil.des3EncodeCBC(FIX_KEY_LOGIN, keyiv, plainText.getBytes("UTF-8"))));
        } catch (Exception e) {
            return "";
        }
    }

    Log logger = LogFactory.getLog(Encoder.class);

    @Test
    public void testEncoder(){
        logger.info(Encoder.encode("bbg001"));
    }
}
